#define _CRT_SECURE_NO_WARNINGS 1


#include<stdio.h>

int find2(int* arr, int index,int x)
{
	int left = 0,t=0,mid=0;
	int right = index - 1;
	for (int i = 0; i < index; i++)
	{
		mid = (left + right) / 2;

		if (x > arr[i])
		{
			mid = right - 1;
		}
		else if (x < arr[i])
		{
			mid = left + 1;
		}
		else
		{
			t = i;
		}
	}
	return t;
}


int main()
{
	int arr[10] = { 1,3,2,4,5,6,7,8,9,0 };
	int t = find2(arr, 10, 5);
	printf("%d", t);
	return 0;
}